# coding=utf-8

import hashlib

try:
    from cStringIO import StringIO
except ImportError:
    try:
        from StringIO import StringIO
    except ImportError:
        from io import StringIO

from flask import Blueprint, render_template, request, redirect, url_for, make_response, session
from over.model import db
from over.handlers.helper import random_str

mod = Blueprint(__name__, 'index')


def make_hash(url, user=None):
    sh = hashlib.sha1()
    sh.update(url)
    if user is not None:
        sh.update(str(user))
    return sh.hexdigest()


@mod.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'GET':
        return render_template('index/index.html')


# @mod.route('/try')
# def _try():
#     return render_template('index/try.html')
